package com.example.logindemo;

import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;

public class CityListActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_city_list);

        RecyclerView rvCityList = findViewById(R.id.rvCityList);
        rvCityList.setLayoutManager(new LinearLayoutManager(this));

        List<City> cityList = new ArrayList<>();
        cityList.add(new City("北京", "中国首都，政治文化中心"));
        cityList.add(new City("上海", "国际金融中心，魔都"));
        cityList.add(new City("广州", "珠三角核心城市，羊城"));
        cityList.add(new City("深圳", "科技创新之都，鹏城"));
        cityList.add(new City("成都", "天府之国，美食之都"));

        CityAdapter adapter = new CityAdapter(cityList);
        rvCityList.setAdapter(adapter);
    }
}